import { NgModule } from '@angular/core';
import { CommonModule as NgCommonModule } from '@angular/common';
import { HttpClientModule } from '@angular/common/http';
import { FormsModule } from '@angular/forms';
import { DxDataGridModule } from 'devextreme-angular/ui/data-grid';

import { AclDirective } from './directive/acl.directive';
import { RuleDirective } from './directive/rule.directive';
import { DictPipe } from './pipe/dict.pipe';
import { DictMapPipe } from './pipe/dict-map.pipe';
import { FixedPipe } from './pipe/fixed.pipe';
import { ViewComponent } from './view/view.component';
import { ViewHeaderComponent } from './view/view-header/view-header.component';
import { ViewActionComponent } from './view/view-action/view-action.component';
import { ViewTitleComponent } from './view/view-title/view-title.component';
import { ViewMainComponent } from './view/view-main/view-main.component';
import { ViewPanelComponent } from './view/view-panel/view-panel.component';
import { ViewInfoComponent } from './view/view-info/view-info.component';
import { ModalTitleComponent } from './modal-title/modal-title.component';
import { ModalFooterComponent } from './modal-footer/modal-footer.component';
import { FormComponent } from './form/form.component';
import { FormItemComponent } from './form/form-item/form-item.component';
import { FormFooterComponent } from './form/form-footer/form-footer.component';
import { SelectFieldModalComponent } from './form/select-field-modal/select-field-modal.component';
import { ValidatorDirective } from './directive/validator.directive';
import { config } from './config';
import { AutoHeightDirective } from './directive/auto-height.directive';
import { ClipboardDirective } from './directive/clipboard.directive';
import { SmoothClickDirective } from './directive/smooth-click.directive';
import { QueryPanelComponent } from './query-panel/query-panel.component';
import { QueryPrimaryActionComponent } from './query-panel/query-primary-action/query-primary-action.component';
import { QuerySecondaryActionComponent } from './query-panel/query-secondary-action/query-secondary-action.component';
import { TablePanelComponent } from './table-panel/table-panel.component';
import { I18nComponent } from './i18n/i18n.component';
import { I18nItemComponent } from './i18n/i18n-item/i18n-item.component';
import { I18nService } from '../core/i18n/i18n.service';
import { NavTabComponent } from './nav-tab/nav-tab.component';
import { BzScrollbarDirective } from './directive/scrollbar.directive';
import { I18nPipe } from './pipe/i18n.pipe';
import { QueryActionBarComponent } from './query-panel/query-action-bar/query-action-bar.component';
import { QUERY_PANEL_LAYOUT } from './keys';
import { ColumnCustomComponent } from './column-custom/column-custom.component';
import { ColumnCustomDirective } from './directive/column-custom.directive';
import { PageJumpDirective } from './directive/page-jump.directive';
import { SummaryDirective } from './directive/summary.directive';
import { ExplainDirective } from './directive/explain.directive';
import { NzSelectDirective } from './directive/patch/nz-select.directive';

import { NzLayoutModule } from 'ng-zorro-antd/layout';
import { NzGridModule } from 'ng-zorro-antd/grid';
import { NzCheckboxModule } from 'ng-zorro-antd/checkbox';
import { NzButtonModule } from 'ng-zorro-antd/button';
import { NzFormModule } from 'ng-zorro-antd/form';
import { NzToolTipModule } from 'ng-zorro-antd/tooltip';
import { NzIconModule } from 'ng-zorro-antd/icon';
import { NzInputModule } from 'ng-zorro-antd/input';
import { NzDatePickerModule } from 'ng-zorro-antd/date-picker';
import { NzTimePickerModule } from 'ng-zorro-antd/time-picker';
import { NzSelectModule } from 'ng-zorro-antd/select';
import { NzCascaderModule } from 'ng-zorro-antd/cascader';
import { NzSwitchModule } from 'ng-zorro-antd/switch';
import { NzTreeSelectModule } from 'ng-zorro-antd/tree-select';
import { NzRadioModule } from 'ng-zorro-antd/radio';
import { NzMenuModule } from 'ng-zorro-antd/menu';
import { NzDropDownModule } from 'ng-zorro-antd/dropdown';
import { FetchOnePipe } from './pipe/fetch-one.pipe';
import { FetchListPipe } from './pipe/fetch-list.pipe';
// import { DataGridRepaintDirective } from './directive/data-grid-repaint.directive';
import { BzDxDataGridDirective } from './directive/patch/dx-data-grid.directive';
import { ViewTipsComponent } from './view/view-tips/view-tips.component';
import { TableComponent } from './table/table.component';
import { NzTableModule } from 'ng-zorro-antd/table';
import { TableColumnComponent } from './table/table-column.component';
import { NzPaginationModule } from 'ng-zorro-antd/pagination';
import { TableSortingComponent } from './table/table-sorting.component';
import { TableSelectionComponent } from './table/table-selection.component';

@NgModule({
  providers: [],
  imports: [
    NgCommonModule,
    FormsModule,

    NzLayoutModule,
    NzGridModule,
    NzCheckboxModule,
    NzButtonModule,
    NzFormModule,
    NzToolTipModule,
    NzIconModule,
    NzInputModule,
    NzDatePickerModule,
    NzTimePickerModule,
    NzSelectModule,
    NzCascaderModule,
    NzSwitchModule,
    NzTreeSelectModule,
    NzRadioModule,
    NzMenuModule,
    NzDropDownModule,
    NzTableModule,
    NzPaginationModule,
  ],
  declarations: [
    AclDirective,
    RuleDirective,
    DictPipe,
    DictMapPipe,
    FixedPipe,
    ViewComponent,
    ViewHeaderComponent,
    ViewActionComponent,
    ViewTitleComponent,
    ViewMainComponent,
    ViewPanelComponent,
    ViewInfoComponent,
    ModalTitleComponent,
    ModalFooterComponent,
    FormComponent,
    FormItemComponent,
    FormFooterComponent,
    SelectFieldModalComponent,
    ValidatorDirective,
    AutoHeightDirective,
    ClipboardDirective,
    SmoothClickDirective,
    QueryPanelComponent,
    QueryPrimaryActionComponent,
    QuerySecondaryActionComponent,
    TablePanelComponent,
    I18nComponent,
    I18nItemComponent,
    NavTabComponent,
    BzScrollbarDirective,
    I18nPipe,
    QueryActionBarComponent,
    ColumnCustomComponent,
    ColumnCustomDirective,
    PageJumpDirective,
    SummaryDirective,
    ExplainDirective,
    NzSelectDirective,
    FetchOnePipe,
    FetchListPipe,
    // DataGridRepaintDirective,
    BzDxDataGridDirective,
    ViewTipsComponent,

    TableComponent,
    TableColumnComponent,
    TableSortingComponent,
    TableSelectionComponent,
  ],
  exports: [
    AclDirective,
    RuleDirective,
    DictPipe,
    DictMapPipe,
    FixedPipe,
    ViewComponent,
    ViewHeaderComponent,
    ViewActionComponent,
    ViewTitleComponent,
    ViewMainComponent,
    ViewPanelComponent,
    ViewInfoComponent,
    ViewTipsComponent,
    ModalTitleComponent,
    ModalFooterComponent,
    FormComponent,
    FormItemComponent,
    FormFooterComponent,
    ValidatorDirective,
    NzSelectDirective,
    DxDataGridModule,
    ClipboardDirective,
    AutoHeightDirective,
    SmoothClickDirective,
    QueryPanelComponent,
    QueryPrimaryActionComponent,
    QuerySecondaryActionComponent,
    TablePanelComponent,
    I18nComponent,
    I18nItemComponent,
    NavTabComponent,
    BzScrollbarDirective,
    I18nPipe,
    QueryActionBarComponent,
    ColumnCustomDirective,
    PageJumpDirective,
    SummaryDirective,
    BzDxDataGridDirective,

    TableComponent,
    TableColumnComponent,
    TableSortingComponent,
    TableSelectionComponent,

    NgCommonModule,
    FormsModule,
    HttpClientModule,

    NzLayoutModule,
    NzGridModule,
    NzCheckboxModule,
    NzButtonModule,
    NzFormModule,
    NzToolTipModule,
    NzIconModule,
    NzInputModule,
    NzDatePickerModule,
    NzTimePickerModule,
    NzSelectModule,
    NzCascaderModule,
    NzSwitchModule,
    NzTreeSelectModule,
    NzRadioModule,
    NzMenuModule,
    NzDropDownModule,
    NzTableModule,
    NzPaginationModule,

    FetchOnePipe,
    FetchListPipe,
    // DataGridRepaintDirective
  ],
  entryComponents: [
    ModalTitleComponent,
    ModalFooterComponent,
    SelectFieldModalComponent,
    ColumnCustomComponent
  ]
})
export class CommonModule {
  constructor(private i18nService: I18nService) {
    // 设置第三方组件库的默认配置
    config(i18nService);
  }
}
